home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 27 / CU Amiga Magazine's Super CD-ROM 27 (1998)(EMAP Images)(GB)[!][issue 1998-10].iso / CUCD / Programming / BlitzC2P / c2p040onlyCLS.ascii < prev    next >
Encoding:
Text File  |  1998-07-28  |  7.0 KB  |  434 lines

  1. WBStartup
  2. NoCli
  3.  
  4. ; CLEARSCREEN version. Additional code by Paul West.
  5.  
  6. ; Non-clearscreen results:
  7.  
  8. ; 040/25 results:
  9.  
  10. ; 320x200 @49.65fps DoublePAL or 55.3fps PAL
  11. ; 320x256 @36.2fps DoublePAL or 42.5fps PAL
  12. ; 320x240 @39.5fps DoublePAL or 45.5fps PAL
  13.  
  14. ; 060/50 results:
  15.  
  16. ; 320x256 @50fps PAL
  17. ; 320x200 @66.1fps PAL
  18.  
  19. #c2pBPLX=320
  20. #c2pBPLY=256
  21. #c2pBPLSIZE=(#c2pBPLX*#c2pBPLY)/8
  22.  
  23. #scrwidth=#c2pBPLX
  24. #scrheight=#c2pBPLY
  25. #screensize=#scrwidth*#scrheight
  26.  
  27. ; c2p1x1_8_c5_040
  28.  
  29. ; 110% on 040-25
  30.  
  31. Statement c2p040onlyinit{A.l,B.l}
  32.  
  33.   ;A.l=d0=Width.w
  34.   ;B.l=d1=Height.w
  35.  
  36. ; d0.w  chunkyx [chunky-pixels]
  37. ; d1.w  chunkyy [chunky-pixels]
  38. ; d3.w  scroffsy [screen-pixels]
  39.  
  40. c2p1x1_8_c5_040_init
  41.   LEA c2p_datanew(pc),a0
  42.   ANDI.l  #$ffff,d0
  43.   MULU.w  d0,d3
  44.   LSR.l #3,d3
  45.   MOVE.l  d3,c2p_scroffs-c2p_data(a0)
  46.   MULU.w  d0,d1
  47.   MOVE.l  d1,c2p_pixels-c2p_data(a0)
  48. AsmExit
  49. End Statement
  50.  
  51. Statement c2p040only{A.l,B.l}
  52.  
  53.   MOVE.l  d0,a0 ; Chunky
  54.   MOVE.l  d1,a1 ; Planar
  55.  
  56. ; a0  c2pscreen
  57. ; a1  bitplanes
  58.  
  59. c2p1x1_8_c5_040
  60.   MOVEM.l a3-a6,-(a7)
  61.  
  62.   MOVEM.l a0-a1,-(a7)
  63.   LEA c2p_datanew,a0
  64.   LEA c2p_data,a1
  65.   MOVEQ #16-1,d0
  66. _c2pcopy: MOVE.l  (a0)+,(a1)+
  67.   DBF d0,_c2pcopy
  68.   MOVEM.l (a7)+,a0-a1
  69.   MOVE.l  a7,stackstore
  70.   MOVE.l  #0,a7
  71.   LEA c2p_data(pc),a2
  72.  
  73.   MOVE.l  c2p_pixels-c2p_data(a2),a3
  74.   ADD.l a0,a3
  75.  
  76.   ADD.w #c2pBPLSIZE,a1
  77.   ADD.l c2p_scroffs-c2p_data(a2),a1
  78.   MOVE.l  a1,a2
  79.   ADD.l #c2pBPLSIZE*4,a2
  80.  
  81.   MOVE.l  (a0),d0
  82.   MOVE.l  a7,(a0)+
  83.   MOVE.l  (a0),d1
  84.   MOVE.l  a7,(a0)+
  85.   MOVE.l  (a0),d2
  86.   MOVE.l  a7,(a0)+
  87.   MOVE.l  (a0),d3
  88.   MOVE.l  a7,(a0)+
  89.   MOVE.l  (a0),d4
  90.   MOVE.l  a7,(a0)+
  91.   MOVE.l  (a0),d5
  92.   MOVE.l  a7,(a0)+
  93.  
  94.   MOVE.l  d4,d7     ; Swap 16x4, part 1
  95.   MOVE.w  d0,d4
  96.   SWAP  d4
  97.   MOVE.w  d4,d0
  98.   MOVE.w  d7,d4
  99.   MOVE.l  d5,d7
  100.   MOVE.w  d1,d5
  101.   SWAP  d5
  102.   MOVE.w  d5,d1
  103.   MOVE.w  d7,d5
  104.  
  105.   MOVE.l  d4,d7     ; Swap 2x4, part 1
  106.   LSR.l #2,d7
  107.   EOR.l d0,d7
  108.   AND.l #$33333333,d7
  109.   EOR.l d7,d0
  110.   LSL.l #2,d7
  111.   EOR.l d7,d4
  112.   MOVE.l  d5,d7
  113.   LSR.l #2,d7
  114.   EOR.l d1,d7
  115.   AND.l #$33333333,d7
  116.   EOR.l d7,d1
  117.   LSL.l #2,d7
  118.   EOR.l d7,d5
  119.  
  120.   MOVE.l  (a0),a5
  121.   MOVE.l  a7,(a0)+
  122.   MOVE.l  (a0),a6
  123.   MOVE.l  a7,(a0)+
  124.  
  125.   EXG d4,a5
  126.   EXG d5,a6
  127.  
  128.   MOVE.l  d4,d7     ; Swap 16x4, part 2
  129.   MOVE.w  d2,d4
  130.   SWAP  d4
  131.   MOVE.w  d4,d2
  132.   MOVE.w  d7,d4
  133.   MOVE.l  d5,d7
  134.   MOVE.w  d3,d5
  135.   SWAP  d5
  136.   MOVE.w  d5,d3
  137.   MOVE.w  d7,d5
  138.  
  139.   MOVE.l  d4,d7     ; Swap 2x4, part 2
  140.   LSR.l #2,d7
  141.   EOR.l d2,d7
  142.   AND.l #$33333333,d7
  143.   EOR.l d7,d2
  144.   LSL.l #2,d7
  145.   EOR.l d7,d4
  146.   MOVE.l  d5,d7
  147.   LSR.l #2,d7
  148.   EOR.l d3,d7
  149.   AND.l #$33333333,d7
  150.   EOR.l d7,d3
  151.   LSL.l #2,d7
  152.   EOR.l d7,d5
  153.  
  154.   MOVE.l  d1,d7     ; Swap 4x1
  155.   LSR.l #4,d7
  156.   EOR.l d0,d7
  157.   AND.l #$0f0f0f0f,d7
  158.   EOR.l d7,d0
  159.   LSL.l #4,d7
  160.   EOR.l d7,d1
  161.   MOVE.l  d3,d7
  162.   LSR.l #4,d7
  163.   EOR.l d2,d7
  164.   AND.l #$0f0f0f0f,d7
  165.   EOR.l d7,d2
  166.   LSL.l #4,d7
  167.   EOR.l d7,d3
  168.  
  169.   BRA _start
  170. _x
  171.   MOVE.l  (a0),d0
  172.   MOVE.l  a7,(a0)+
  173.   MOVE.l  (a0),d1
  174.   MOVE.l  a7,(a0)+
  175.   MOVE.l  (a0),d2
  176.   MOVE.l  a7,(a0)+
  177.   MOVE.l  (a0),d3
  178.   MOVE.l  a7,(a0)+
  179.   MOVE.l  (a0),d4
  180.   MOVE.l  a7,(a0)+
  181.   MOVE.l  (a0),d5
  182.   MOVE.l  a7,(a0)+
  183.  
  184.   MOVE.l  a6,-c2pBPLSIZE(a1)
  185.  
  186.   MOVE.l  d4,d7     ; Swap 16x4, part 1
  187.   MOVE.w  d0,d4
  188.   SWAP  d4
  189.   MOVE.w  d4,d0
  190.   MOVE.w  d7,d4
  191.   MOVE.l  d5,d7
  192.   MOVE.w  d1,d5
  193.   SWAP  d5
  194.   MOVE.w  d5,d1
  195.   MOVE.w  d7,d5
  196.  
  197.   MOVE.l  d4,d7     ; Swap 2x4, part 1
  198.   LSR.l #2,d7
  199.   EOR.l d0,d7
  200.   AND.l #$33333333,d7
  201.   EOR.l d7,d0
  202.   LSL.l #2,d7
  203.   EOR.l d7,d4
  204.   MOVE.l  d5,d7
  205.   LSR.l #2,d7
  206.   EOR.l d1,d7
  207.   AND.l #$33333333,d7
  208.   EOR.l d7,d1
  209.   LSL.l #2,d7
  210.   EOR.l d7,d5
  211.  
  212.   MOVE.l  (a0),d7
  213.   MOVE.l  a7,(a0)+
  214.   MOVE.l  (a0),a6
  215.   MOVE.l  a7,(a0)+
  216.  
  217.   MOVE.l  a5,-c2pBPLSIZE(a2)
  218.  
  219.   MOVE.l  d7,a5
  220.   EXG d4,a5
  221.   EXG d5,a6
  222.  
  223.   MOVE.l  d4,d7     ; Swap 16x4, part 2
  224.   MOVE.w  d2,d4
  225.   SWAP  d4
  226.   MOVE.w  d4,d2
  227.   MOVE.w  d7,d4
  228.   MOVE.l  d5,d7
  229.   MOVE.w  d3,d5
  230.   SWAP  d5
  231.   MOVE.w  d5,d3
  232.   MOVE.w  d7,d5
  233.  
  234.   MOVE.l  d4,d7     ; Swap 2x4, part 2
  235.   MOVE.l  d6,(a2)+
  236.   LSR.l #2,d7
  237.   EOR.l d2,d7
  238.   AND.l #$33333333,d7
  239.   EOR.l d7,d2
  240.   LSL.l #2,d7
  241.   EOR.l d7,d4
  242.   MOVE.l  d5,d7
  243.   LSR.l #2,d7
  244.   EOR.l d3,d7
  245.   AND.l #$33333333,d7
  246.   EOR.l d7,d3
  247.   LSL.l #2,d7
  248.   EOR.l d7,d5
  249.  
  250.   MOVE.l  d1,d7     ; Swap 4x1
  251.   LSR.l #4,d7
  252.   EOR.l d0,d7
  253.   MOVE.l  a4,(a1)+
  254.   AND.l #$0f0f0f0f,d7
  255.   EOR.l d7,d0
  256.   LSL.l #4,d7
  257.   EOR.l d7,d1
  258.   MOVE.l  d3,d7
  259.   LSR.l #4,d7
  260.   EOR.l d2,d7
  261.   AND.l #$0f0f0f0f,d7
  262.   EOR.l d7,d2
  263.   LSL.l #4,d7
  264.   EOR.l d7,d3
  265. _start
  266.  
  267.   MOVE.l  d2,d7     ; Swap 8x2, part 1
  268.   LSR.l #8,d7
  269.   EOR.l d0,d7
  270.   AND.l #$00ff00ff,d7
  271.   EOR.l d7,d0
  272.   LSL.l #8,d7
  273.   EOR.l d7,d2
  274.   MOVE.l  d2,d7
  275.   LSR.l #1,d7     ; Swap 1x2, part 1
  276.   EOR.l d0,d7
  277.   AND.l #$55555555,d7
  278.   EOR.l d7,d0
  279.   MOVE.l  d0,c2pBPLSIZE*2(a2)
  280.   ADD.l d7,d7
  281.   EOR.l d7,d2
  282.   MOVE.l  d3,d7     ; Swap 8x2, part 2
  283.   LSR.l #8,d7
  284.   EOR.l d1,d7
  285.   AND.l #$00ff00ff,d7
  286.   EOR.l d7,d1
  287.   LSL.l #8,d7
  288.   EOR.l d7,d3
  289.   MOVE.l  d3,d7
  290.   LSR.l #1,d7     ; Swap 1x2, part 2
  291.   EOR.l d1,d7
  292.   AND.l #$55555555,d7
  293.   EOR.l d7,d1
  294.   MOVE.l  d1,c2pBPLSIZE*2(a1)
  295.   ADD.l d7,d7
  296.   EOR.l d7,d3
  297.  
  298.   MOVE.l  d5,d7
  299.   LSR.l #4,d7
  300.   EOR.l d4,d7
  301.   AND.l #$0f0f0f0f,d7
  302.   EOR.l d7,d4
  303.   LSL.l #4,d7
  304.   EOR.l d7,d5
  305.  
  306.   EXG d4,a5
  307.   EXG d5,a6
  308.  
  309.   MOVE.l  d5,d7
  310.   LSR.l #4,d7
  311.   EOR.l d4,d7
  312.   AND.l #$0f0f0f0f,d7
  313.   EOR.l d7,d4
  314.   LSL.l #4,d7
  315.   EOR.l d7,d5
  316.  
  317.   MOVE.l  a5,d0
  318.   MOVE.l  a6,d1
  319.   MOVE.l  d2,c2pBPLSIZE(a2)
  320.  
  321.  
  322.   MOVE.l  d0,d7     ; Swap 8x2, part 3
  323.   LSR.l #8,d7
  324.   EOR.l d4,d7
  325.   AND.l #$00ff00ff,d7
  326.   EOR.l d7,d4
  327.   LSL.l #8,d7
  328.   EOR.l d7,d0
  329.   MOVE.l  d0,d7
  330.   LSR.l #1,d7     ; Swap 1x2, part 3
  331.   EOR.l d4,d7
  332.   AND.l #$55555555,d7
  333.   EOR.l d7,d4
  334.   ADD.l d7,d7
  335.   EOR.l d7,d0
  336.   MOVE.l  d1,d7     ; Swap 8x2, part 4
  337.   LSR.l #8,d7
  338.   MOVE.l  d3,c2pBPLSIZE(a1)
  339.   EOR.l d5,d7
  340.   AND.l #$00ff00ff,d7
  341.   EOR.l d7,d5
  342.   LSL.l #8,d7
  343.   EOR.l d7,d1
  344.   MOVE.l  d1,d7
  345.   LSR.l #1,d7     ; Swap 1x2, part 4
  346.   EOR.l d5,d7
  347.   AND.l #$55555555,d7
  348.   EOR.l d7,d5
  349.   ADD.l d7,d7
  350.   EOR.l d7,d1
  351.  
  352.   MOVE.l  d0,a5
  353.   MOVE.l  d1,a6
  354.  
  355.   MOVE.l  d4,d6
  356.   MOVE.l  d5,a4
  357.  
  358.   CMP.l a0,a3
  359.   BNE _x
  360.  
  361.   MOVE.l  a6,-c2pBPLSIZE(a1)
  362.   MOVE.l  a5,-c2pBPLSIZE(a2)
  363.   MOVE.l  d6,(a2)+
  364.   MOVE.l  a4,(a1)+
  365.  
  366.   MOVE.l  stackstore(pc),a7
  367.   MOVEM.l (a7)+,a3-a6
  368. AsmExit
  369.  
  370.   Even4
  371. stackstore: Dc.l 0
  372. c2p_data
  373. c2p_scroffs: Dc.l 0
  374. c2p_pixels: Dc.l 0
  375.   Ds.l  16
  376.   Even4
  377. c2p_datanew
  378.   Ds.l  16
  379. End Statement
  380.  
  381.  
  382.  
  383.  
  384. .blitzprogram
  385. ; Setup
  386. InitBank 0,(#scrwidth*#scrheight)+1000,2|65536 ; Chipram planar buffer
  387. CludgeBitMap 0,#scrwidth,#scrheight,8,Bank(0)
  388. InitPalette 0,256
  389. For c=0 To 255
  390.   AGAPalRGB 0,c,Rnd(c),Rnd(c),Rnd(c)
  391. Next c
  392. AGAPalRGB 0,0,0,0,0
  393. Screen 0,0,0,#scrwidth,#scrheight,8,0,"c2p test",0,0,0
  394. Use Palette 0
  395. VWait 50
  396. baseaddress1.l=AllocMem(#scrwidth*#scrheight,$10000) ; Fastram chunky buffer
  397.  
  398. ; Put something into the chunky buffer so we can see it working
  399. GetReg a0,baseaddress1
  400. MOVE.l  #0,d0
  401. MOVE.l  #screensize-1,d1
  402. cloop
  403.   MOVE.b  d0,(a0)+
  404.   ADDQ.l  #1,d0
  405.   SUBQ.l  #1,d1
  406.   TST.l   d1
  407.   BLT     done
  408.   BRA     cloop
  409. done
  410.  
  411. ; Do the c2p test
  412. c2p040onlyinit{#scrwidth,#scrheight}
  413. VWait 20
  414. Forbid_
  415. VWait
  416. ResetTimer
  417. For time=1 To 800
  418.   c2p040only{baseaddress1,Bank(0)} ; Convert chunky to planar
  419. Next time
  420. t=Ticks
  421. VWait 2 : Permit_
  422. VWait 20
  423. FindScreen 0
  424. Window 0,0,11,640,100,0,"Test results for c2p",0,0
  425. WindowOutput 0
  426. NPrint "Routine performed @ ",50/(t/800),"fps - ",t," ticks"
  427. NPrint " "
  428. NPrint "Press mousebutton..."
  429. Free Screen 0
  430. MouseWait
  431. Free Window 0
  432. End
  433.  
  434.